# Maintainer: Jelle van der Waa <jelle@archlinux.org>

pkgname=python-meilisearch
pkgver=0.28.1
pkgrel=1
pkgdesc='Python client for MeiliSearch API'
arch=(any)
license=('MIT')
url='https://pypi.org/project/meilisearch/'
depends=(python python-requests python-camel-converter python-pydantic)
makedepends=(python-setuptools python-build python-installer python-wheel)
checkdepends=(python-pytest python-pytest-ordering)
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/meilisearch/meilisearch-python/archive/v${pkgver}.tar.gz)
sha512sums=('7f9103dadac7b5595dba66fd99916b636d614ee4646a6b6610574ba719709c99edff54032a3e88e163ac22fd4dd72eb1522508ee1cd7afd679b525303ce71677')

build() {
  cd "meilisearch-python-${pkgver}"
  python -m build --wheel --no-isolation
}

check() {
  # requires running meilisearch https://github.com/meilisearch/meilisearch-python/blob/master/.github/workflows/test.yml#L20
  cd "meilisearch-python-${pkgver}"
  #pytest .
}

package() {
  cd "meilisearch-python-${pkgver}"

  python -m installer --destdir="$pkgdir" dist/*.whl

  install -D -m644 LICENSE "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}
